from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `zhan_order` ADD `goods_id` INT;
        ALTER TABLE `zhan_order` ADD CONSTRAINT `fk_zhan_ord_zhan_goo_d9341fc2` FOREIGN KEY (`goods_id`) REFERENCES `zhan_goods` (`id`) ON DELETE SET NULL;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `zhan_order` DROP FOREIGN KEY `fk_zhan_ord_zhan_goo_d9341fc2`;
        ALTER TABLE `zhan_order` DROP COLUMN `goods_id`;"""
